<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>DOM</title>
</head>
<body>
    <button>测试</button>
    <script>
        let ele = document.getElementsByTagName('button')[0]
        // ele.onclick = function () {
        //     alert('点击事件发生了')
        // }
        function clickevent(){
            alert('使用addEvenListener触发事件')
        }
        document.addEventListener('click',clickevent)
    </script>
</body>
</html>